

<HTML>

<HEAD>

<LINK rel="stylesheet" href="../exer.css">

</HEAD>

<BODY>

<H1>

Data Structures, Algorithms, & Applications in C++<BR>

Chapter 12, Exercise 9<BR>

<BR>

</H1>







<pre class=code>

<strong>AbstractDataType</strong> <em>WeightedDigraph</em> {

   <strong>instances</strong>

      a set <em>V</em> of vertices and a set <em>E</em> of edges

   <strong>operations</strong>

      <em>Create(n):</em> create a directed graph with <em>n</em> vertices and no edges

      <em>Exist(i, j):</em> return <code>true</code> if edge <em>(i,j)</em> exists; <code>false</code> otherwise

      <em>Edges():</em> return the number of edges in the graph

      <em>Vertices():</em> return the number of vertices in the graph

      <em>Add(i, j, w):</em> add the edge <em>(i,j)</em> with weight <em>w</em> to the graph

      <em>Delete(i, j):</em> delete the edge <em>(i,j)</em> 

      <em>InDegree(i):</em> return the in-degree of vertex <em>i</em>

      <em>OutDegree(i):</em> return the out-degree of vertex <em>i</em>

}

</pre>



</FONT>

</BODY>

</HTML>

